

String.prototype.toPHP = function() {
  var s = this
  s = s.replace(/\\/g, "\\\\")
  s = s.replace(/\"/g, "\\\"")
  s = s.replace(/\n/g, "\\n")
  s = s.replace(/\r/g, "")
  return 's:' + s.length + ':"' + s + '";';
}